<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('律所机构信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>名称：</label>
                                <input type="text" name="userName"/>
                            </li>
                            <li>
                                <label>手机号：</label>
                                <input type="text" name="mobile"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="business:lawFirm:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.editFull()" shiro:hasPermission="business:lawFirm:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="business:lawFirm:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="business:lawFirm:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var listFlag = [[${@permission.hasPermi('business:lawFirm:edit')}]];
        var editFlag = [[${@permission.hasPermi('business:lawFirm:edit')}]];
        var removeFlag = [[${@permission.hasPermi('business:lawFirm:remove')}]];
        var userTypeDatas = [[${@dict.getType('user_type')}]];
        var auditStatusDatas = [[${@dict.getType('approval_status')}]];
        var prefix = ctx + "business/lawFirm";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "律所机构信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'userId',
                    title: '用户id',
                    visible: false
                },
                {
                    field: 'loginId',
                    title: '登录账号'
                },
                {
                    field: 'password',
                    title: '密码'
                },
                // {
                //     field: 'userType',
                //     title: '用户类型，0个人，1,律师，2机构',
                //     formatter: function(value, row, index) {
                //        return $.table.selectDictLabel(userTypeDatas, value);
                //     }
                // },
                {
                    field: 'userName',
                    title: '名称'
                },
                {
                    field: 'idCard',
                    title: '身份证号码'
                },
                {
                    field: 'address',
                    title: '地址'
                },
                {
                    field: 'mobile',
                    title: '手机号'
                },
                {
                    field: 'email',
                    title: '邮箱'
                },
                // {
                //     field: 'lawyerCertificateNo',
                //     title: '律师执业证件号--律师'
                // },
                {
                    field: 'socialUnifiedCreditCode',
                    title: '社会统一信用代码'
                },
                {
                    field: 'legalRepresentative',
                    title: '法定代表人'
                },
                {
                    field: 'fixedTelephone',
                    title: '联系电话'
                },
                // {
                //     field: 'lawFirmName',
                //     title: '所在律师事务所名称--律师'
                // },
                {
                    field: 'headPortrait',
                    title: '头像',
                    formatter: function(value, row, index) {
                        return $.table.imageView(value, '');
                    }
                },
                {
                    field: 'idCardFacade',
                    title: '身份证照片正面',
                    formatter: function(value, row, index) {
                        return $.table.imageView(value, '');
                    }
                },
                {
                    field: 'idCardBack',
                    title: '身份证照片反面',
                    formatter: function(value, row, index) {
                        return $.table.imageView(value, '');
                    }
                },
                {
                    field: 'businessLicenseImage',
                    title: '营业执照照片',
                    formatter: function(value, row, index) {
                        return $.table.imageView(value, '');
                    }
                },
                // {
                //     field: 'lawyerCertificateImage',
                //     title: '律师执业证书照片'
                // },
                // {
                //     field: 'balance',
                //     title: '账户余额'
                // },
                {
                    field: 'auditStatus',
                    title: '审核状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(auditStatusDatas, value);
                    }
                },
                {
                    field: 'auditTime',
                    title: '审核时间'
                },
                {
                    field: 'remark',
                    title: '备注',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value, 5, "open");
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + listFlag + '" href="javascript:void(0)" onclick="audit(\'' + row.userId + '\')"><i class="fa fa-edit"></i>审核</a> ');

                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + listFlag + '" href="javascript:void(0)" onclick="info(\'' + row.userId + '\')"><i class="fa fa-edit"></i>详情</a> ');

                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        function audit(userId) {
            var url = prefix + '/audit/' + userId;
            $.modal.openFull("审核", url);
        }
        function info(userId) {
            var url = prefix + '/audit/' + userId;
            $.modal.openFull("详情", url);
        }
    </script>
</body>
</html>